<template>
  <div style="margin: 0 20px">
    <el-card style="margin-bottom: 16px">
      <div slot="header" style="display: flex; justify-content: space-between">
        <span style="font-size: 16px"> 待退回数量 </span>
      </div>
      <KoiCard
        :row="row"
        @getdeliveryDurationRange="getdeliveryDurationRange"
      />
    </el-card>
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          >导出</el-button
        >
      </el-col>
      <!-- <el-col :span="1.5">
        <el-button
          type="primary"
          size="mini"
          @click="handleGo('/sample/statistics')"
        >
          跳转详细报表
        </el-button>
      </el-col> -->
      <right-toolbar
        :showSearch.sync="showSearch"
        @queryTable="getList"
      ></right-toolbar>
    </el-row>
    <div ref="tableDom">
      <u-table
        :data="sampleApplyList"
        use-virtual
        :row-height="30"
        :height="630"
        :border="false"
      >
        <!-- <u-table-column type="selection" width="45" align="center" /> -->
        <u-table-column label="ID" align="center" prop="id" />
        <u-table-column label="内部订单" align="center" prop="bindingSoid">
          <template
            slot-scope="scope"
            v-if="
              scope.row.applyStatus !== 'to_apply' &&
              scope.row.applyStatus !== 'dingding_approval'
            "
          >
            <span>{{ scope.row.bindingSoid }}</span>
          </template>
        </u-table-column>
        <!-- style="width: 180px" -->
        <u-table-column
          label="部门"
          align="center"
          prop="deptName"
          width="150"
          :show-overflow-tooltip="true"
        >
          <!-- <template slot-scope="scope">
            <onerow :popoverInput="scope.row.deptName" />
          </template> -->
        </u-table-column>

        <u-table-column
          label="负责人"
          align="center"
          prop="responsiblePerson"
          width="150"
          :show-overflow-tooltip="true"
        />

        <u-table-column
          label="订单状态"
          align="center"
          prop="applyStatus"
          width="150"
        >
          <template slot-scope="scope">
            <div>
              {{ scope.row.applyStatus | state2 }}
            </div>
            <!-- <div v-show="scope.row.applyStatus !== 'to_apply'"
              style="color: rgb(37, 137, 255); cursor: pointer; text-decoration: underline;"
              @click="statusList(scope.row)">
              流转记录
            </div> -->
          </template>
        </u-table-column>
        <!-- <u-table-column label="达人信息表ID" align="center" prop="sampleTalentInfoId" />
      <u-table-column label="笔记/直播合作ID" align="center" prop="sampleTalentCooperateId" /> -->
        <!-- ，笔记=note;直播=live -->
        <u-table-column
          label="合作类型"
          align="center"
          prop="sampleTalentCooperateType"
        >
          <template slot-scope="scope">
            <div>
              {{ scope.row.sampleTalentCooperateType | state1 }}
            </div>
          </template>
        </u-table-column>
        <u-table-column
          label="选择品牌"
          align="center"
          prop="brand"
          width="110"
        />
        <!-- <u-table-column label="模板ID" align="center" prop="templateId" /> -->
        <!-- <u-table-column label="颜色ID" align="center" prop="templateSecondryId" />
      <u-table-column label="尺寸ID" align="center" prop="templateSizeId" />
      <u-table-column label="联系方式ID" align="center" prop="contactId" width="90" /> -->
        <u-table-column
          label="合作款式"
          align="center"
          prop="productNo"
          width="110"
        />

        <u-table-column
          label="款式主图"
          align="center"
          prop="picUrl"
          width="110"
        >
          <!-- <template slot-scope="scope">
            <image-preview :src="scope.row.picUrl" :width="50" :height="50" />
          </template> -->
          <template #default="scope">
            <image-preview :src="scope.row.picUrl" :width="40" :height="40" />
            <!-- <el-popover
              effect="light"
              trigger="click"
              placement="right"
              width="auto"
              v-if="scope.row.picUrl"
            >
              <template #default>
                <img
                  :src="scope.row.picUrlFull"
                  style="width: 800px; height: 600px; object-fit: contain"
                  lazy
                />
              </template>
              <template #reference>
                <img
                  :src="scope.row.picUrlFull"
                  style="object-fit: contain; width: 40px; height: 40px"
                  lazy
                />
              </template>
            </el-popover> -->
          </template>
        </u-table-column>
        <u-table-column
          label="商品编码"
          align="center"
          prop="productCode"
          width="150"
        />
        <u-table-column label="商品数量" align="center" prop="productNum" />
        <u-table-column
          label="颜色属性"
          align="center"
          prop="colorProperty"
          width="150"
        />
        <u-table-column label="尺寸" align="center" prop="size" />
        <u-table-column label="季节" align="center" prop="productSeason" />
        <u-table-column
          label="一级类目"
          align="center"
          prop="firstLevelColumn"
          width="100"
        />
        <u-table-column
          label="二级类目"
          align="center"
          prop="secondLevelColumn"
          width="100"
        />
        <u-table-column
          label="三级类目"
          align="center"
          prop="threeLevelColumn"
          width="160"
        />
        <u-table-column
          width="200"
          label="平台名称"
          align="center"
          prop="platform"
        />
        <u-table-column
          label="平台ID"
          align="center"
          prop="platformId"
          width="180"
        />
        <u-table-column
          label="昵称"
          align="center"
          prop="xhsNickname"
          width="180"
        />

        <u-table-column
          label="收件人"
          align="center"
          prop="recipient"
          width="180"
        />
        <u-table-column label="电话" align="center" prop="phone" width="110" />
        <u-table-column
          label="收件人地址"
          align="center"
          prop="address"
          width="200"
        >
          <template slot-scope="scope">
            <el-popover trigger="hover" placement="bottom" width="300">
              <el-input
                v-model="scope.row.address"
                :min-height="192"
                type="textarea"
                :autosize="{ minRows: 2, maxRows: 24 }"
                :style="{ width: '100%' }"
                :disabled="true"
              />
              <div slot="reference">
                <span class="textname">{{ scope.row.address }} </span>
              </div>
            </el-popover>
          </template>
        </u-table-column>
        <u-table-column
          label="地址备注信息"
          align="center"
          prop="addressRemarks"
          width="200"
        >
          <template slot-scope="scope">
            <el-popover trigger="hover" placement="bottom" width="300">
              <el-input
                v-model="scope.row.addressRemarks"
                :min-height="192"
                type="textarea"
                :autosize="{ minRows: 2, maxRows: 24 }"
                :style="{ width: '100%' }"
                :disabled="true"
              />
              <div slot="reference">
                <span class="textname">{{ scope.row.addressRemarks }} </span>
              </div>
            </el-popover>
          </template>
        </u-table-column>
        <u-table-column
          label="签收时间"
          align="center"
          prop="signedTime"
          width="180"
        ></u-table-column>
        <u-table-column label="是否归还" align="center" prop="isReturn" />
        <u-table-column
          width="200"
          label="最终归还状态"
          align="center"
          prop="finalIsReturn"
        />
        <u-table-column
          width="200"
          label="归还补充说明"
          align="center"
          prop="isReturnRemark"
        >
          <template slot-scope="scope">
            <el-popover trigger="hover" placement="bottom" width="300">
              <el-input
                v-model="scope.row.isReturnRemark"
                :min-height="192"
                type="textarea"
                :autosize="{ minRows: 2, maxRows: 24 }"
                :style="{ width: '100%' }"
                :disabled="true"
              />
              <div slot="reference">
                <span class="textname">{{ scope.row.isReturnRemark }} </span>
              </div>
            </el-popover>
          </template>
        </u-table-column>
        <u-table-column label="发货备注" align="center" prop="innerApplyReason">
          <template slot-scope="scope">
            <el-popover trigger="hover" placement="bottom" width="300">
              <el-input
                v-model="scope.row.innerApplyReason"
                :min-height="192"
                type="textarea"
                :autosize="{ minRows: 2, maxRows: 24 }"
                :style="{ width: '100%' }"
                :disabled="true"
              />
              <div slot="reference">
                <span class="textname">{{ scope.row.innerApplyReason }} </span>
              </div>
            </el-popover>
          </template>
        </u-table-column>
        <u-table-column
          width="200"
          label="直播间名称"
          align="center"
          prop="liveRoomName"
        />
        <u-table-column
          label="申请时间"
          align="center"
          prop="createTime"
          width="180"
        />
        <u-table-column label="快递公司" align="center" prop="expressCompany" />
        <u-table-column
          label="快递单号"
          align="center"
          prop="expressNumber"
          width="150"
        >
          <template slot-scope="scope">
            <el-popover trigger="hover" placement="bottom" width="300">
              <el-input
                v-model="scope.row.expressNumber"
                :min-height="192"
                type="textarea"
                :autosize="{ minRows: 2, maxRows: 24 }"
                :style="{ width: '100%' }"
                :disabled="true"
              />
              <div slot="reference">
                <span class="textname">{{ scope.row.expressNumber }} </span>
              </div>
            </el-popover>
          </template>
        </u-table-column>
        <u-table-column
          label="发货时间"
          align="center"
          prop="deliveryTime"
          width="180"
        >
        </u-table-column>
        <u-table-column
          label="发货时长"
          align="center"
          prop="deliveryDuration"
          width="180"
        >
        </u-table-column>
        <u-table-column
          label="发货时长范围"
          align="center"
          prop="deliveryDurationRange"
          width="180"
        >
        </u-table-column>
        <u-table-column
          label="申请人"
          align="center"
          prop="buyerAccount"
          width="250"
          :show-overflow-tooltip="true"
        >
          <!-- <template slot-scope="scope">
            <onerow :popoverInput="scope.row.buyerAccount" />
          </template> -->
        </u-table-column>
        <u-table-column label="待退货数量" align="center" prop="toReturnNum" />
        <u-table-column label="退货中数量" align="center" prop="returningNum" />
        <u-table-column label="已退回数量" align="center" prop="returnedNum" />
        <!-- <u-table-column label="退货情况" align="center" prop="">
          <template slot-scope="scope">
            <div
              style="
                color: rgb(37, 137, 255);
                cursor: pointer;
                text-decoration: underline;
              "
              @click="getlistSampleReturn(scope.row)"
            >
              退货信息
            </div>
            <el-button size="mini" @click="goto(scope.row)">
              退货数据
            </el-button>
          </template>
        </u-table-column> -->
        <!-- 
         
          
          <u-table-column label="固话" align="center" prop="fixedLine" />
        <u-table-column label="卖家备注" align="center" prop="remark" />
        <u-table-column label="线上订单号" align="center" prop="onlineNumber" width="130" />
        <u-table-column label="子订单编号" align="center" prop="subOrderNumber" width="130" />

        <u-table-column label="支付单号" align="center" prop="paymentOrderNumber" />
        <u-table-column label="付款方式" align="center" prop="paymentMethod" />
        <u-table-column label="运费" align="center" prop="freight" />
        <u-table-column label="应付金额" align="center" prop="payableAmount" />

        <u-table-column label="邮编" align="center" prop="zipCode" />

        
        <u-table-column label="商品名称" align="center" prop="productName" />
        <u-table-column label="商品单价" align="center" prop="productPricing" />
        <u-table-column label="商品成本" align="center" prop="productCost" />
        <u-table-column label="结算金额" align="center" prop="productSettlment" />
        <u-table-column label="生产批次" align="center" prop="productBatch" />
        <u-table-column label="生产日期" align="center" prop="manufactureDate">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.manufactureDate, '{y}-{m}-{d}') }}</span>
          </template>
        </u-table-column>
        <u-table-column label="快递公司" align="center" prop="expressCompany" />
        <u-table-column label="快递单号" align="center" prop="expressNumber" />
        <u-table-column label="发货时间" align="center" prop="deliveryTime">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.deliveryTime, '{y}-{m}-{d}') }}</span>
          </template>
        </u-table-column>
        <u-table-column label="业务员" align="center" prop="salesman" />
        <u-table-column label="便签|线下备注" align="center" prop="offlineNotes" width="130" />
        
        <u-table-column label="退货电话" align="center" prop="returnPhone" />
        <u-table-column label="退货收件人" align="center" prop="returnRecipient" width="100" />
        <u-table-column label="退货收件人地址" align="center" prop="returnAddress" width="130">
          <template slot-scope="scope">
            <el-popover trigger="hover" placement="top" width="300">
              
              <el-input v-model="scope.row.returnAddress" :min-height="192" type="textarea"
                :autosize="{ minRows: 2, maxRows: 24 }" :style="{ width: '100%' }" :disabled="true" />
              <div slot="reference">
                <span class="textname">{{ scope.row.returnAddress }}
                </span>
              </div>
            </el-popover>
          </template>
        </u-table-column> -->

        <!-- <u-table-column label="逻辑删除;0=未删除；1=已删除" align="center" prop="isDelete" /> -->
      </u-table>
    </div>

    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="row.pageNum"
      :limit.sync="row.thisPageSize"
      :page-sizes="[10, 30, 50, 100, 120, 150, 200]"
      @pagination="getList"
    />
  </div>
</template>

<script>
import AddressParse from "address-parse";
import {
  listContact,
  getContact,
  delContact,
  addContact,
  updateContact,
} from "@/api/sample/contact";
import {
  listReturnAddress,
  getReturnAddress,
  delReturnAddress,
  addReturnAddress,
  updateReturnAddress,
  search,
  returnApplyByApplyID,
} from "@/api/sample/returnAddress";
import { Notification, MessageBox, Message, Loading } from "element-ui";
// import { tansParams, blobValidate } from "@/utils/ruoyi";
// import axios from "axios";
import { inventory } from "@/api/sample/sample";
import {
  listSampleReturn,
  getSampleReturn,
  delSampleReturn,
  addSampleReturn,
  updateSampleReturn,
} from "@/api/sample/sampleReturn";
// import { listUser, getUser, delUser, addUser, updateUser, resetUserPwd, changeUserStatus, deptTreeSelect } from "@/api/system/user";
// import { getInfo } from "@/api/login.js";
import {
  listSecondry,
  getSecondry,
  delSecondry,
  addSecondry,
  updateSecondry,
  getInfoByName,
  productNoColorLike,
  listAll,
} from "@/api/product/secondry";
import {
  listTemplate,
  getTemplate,
  delTemplate,
  addTemplate,
  updateTemplate,
  addTemplateAndSecondry,
  addProNoColorSize,
  productNoLike,
} from "@/api/product/template";
import { selectSampleTalentApplyVOList } from "@/api/sample/OdsSampleTalentApplyReport";
import {
  listLiveroom,
  getLiveroom,
  delLiveroom,
  addLiveroom,
  updateLiveroom,
} from "@/api/sample/liveroom";
//--------导入token
import { getToken } from "@/utils/auth";
import { tansParams, blobValidate } from "@/utils/ruoyi";
import cache from "@/plugins/cache";
import { saveAs } from "file-saver";
//数据获取
import { pcaa } from "area-data";
import { getInfo } from "@/api/login.js";
import axios from "axios";
// import { EXPORT_EXCEL } from "./xlsx";
import { downLoadTemplate } from "@/api/data/template";
import KoiCard from "./KoiCard";
export default {
  name: "dialogApply",
  props: {
    row: {
      type: Object,
      default: () => {},
    },
  },
  dicts: [
    "sys_product_qudao",
    "sys_one_zero",
    "sys_product_size",
    "sys_sample_sf",
    "sys_jst_sample_sf",
    "sys_product_pp",
    "sys_product_jijie",
    "sys_product_secondary",
    "sys_product_cycle",
    "sys_product_pl",
  ],
  components: {
    KoiCard,
  },
  data() {
    return {
      //直播间名称
      liveroomList: [],
      finalIsReturn: "是",
      openbatchReturn: false,
      //检查库存
      heightInventory: 500,
      openInventory: false,
      msgInventory: [],

      //当前操作用户角色
      roles: [],
      //文本粘贴
      demo: "",
      //省市区
      pcaaData: pcaa,
      // 区域数据
      provinces: pcaa["86"],
      citys: [],
      areas: [],

      //达人收件信息
      productNooptions: [],
      optionsContact: [],
      formVFU: {
        isReturn: "是",

        expressCompany: "中通快递",
      },
      //选中get
      sampleTalentInfoId: [],
      //上门取件
      Visiblereturn: false,
      fReturn: {
        pickupDayType: "今天",
        expressCompany: "中通快递",
      },
      returnAddressList: [],
      //上门时间
      returnDate: "15:00-17:00",
      //上门取件or自行寄出
      Status: 0,
      noSelf: false,
      VisibleSelf: false,
      // 导入
      openmsg: false,
      msg: "",
      fileLi: [],
      dialogVisible: false,
      limit: 2,
      Upload: {
        // 设置上传的请求头部
        headers: {
          header: { responseType: "blob" },

          Authorization: "Bearer " + getToken(),
        },
        // 图片上传的方法地址:
        url:
          process.env.VUE_APP_BASE_API +
          "/product/sampleApply/importSampleTalentApply",
      },
      //库存量
      num: "",
      pjtUrl: process.env.VUE_APP_BASE_API,
      // 我的待办数量
      listSample: "",
      openCheck: false,
      //退货情况
      sampleReturnList: [],
      openReturnList: false,
      //我的申请
      applyname: "",

      tableHeight: "",
      //是否显示待办
      TypeCheck: false,
      //我的申请
      state: 1,
      userId: "",
      //流程弹出框
      ApplyList: [],
      openApply: false,
      //申请按钮
      formApply: {},
      Visibleapply: false,
      //审批按钮
      VisibleCheck: false,
      formCheck: {},
      //选中get
      to_apply: [],
      list: [],
      username: [],
      color: [],
      size: [],
      productNum: [],
      isReturn: [],
      //模糊匹配
      sizeList: [],
      ColorLike: [],
      options: [], // 选项，从后端传递过来
      //搜索栏展示和收起
      isOpen: false,
      filePay: [],
      pjtUrl: process.env.VUE_APP_BASE_API,
      // 图片数量限制
      limit: 2,
      imgUpload: {
        // 设置上传的请求头部
        headers: {
          Authorization: "Bearer " + getToken(),
        },
        // 图片上传的方法地址:
        url: process.env.VUE_APP_BASE_API + "/common/upload",
      },
      //待提交申请禁用
      to_sumbit: false,

      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 样衣申请记录表格数据
      sampleApplyList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        id: null,
        applyId: null,
        sampleTalentInfoId: null,
        sampleTalentCooperateId: null,
        sampleTalentCooperateType: null,
        templateId: null,
        templateSecondryId: null,
        templateSizeId: null,
        contactId: null,
        isReturn: null,
        onlineNumber: null,
        subOrderNumber: null,
        buyerAccount: null,
        paymentOrderNumber: null,
        paymentMethod: null,
        freight: null,
        payableAmount: null,
        fixedLine: null,
        zipCode: null,
        styleMainImage: null,
        productCode: null,
        productNum: null,
        productName: null,
        productPricing: null,
        productCost: null,
        productSettlment: null,
        productBatch: null,
        manufactureDate: null,
        expressCompany: null,
        expressNumber: null,
        deliveryTime: null,
        salesman: null,
        offlineNotes: null,
        applyStatus: null,
        isDelete: null,
        returnPhone: null,
        returnRecipient: null,
        returnAddress: null,
        returnContactId: null,
        returnExpressPickupCode: null,
        returnExpressNumber: null,
        returnDate: null,
        platform: null,
        platformId: null,
        xhsNickname: null,
        applyDateStart: null,
        applyDateEnd: null,
        productNo: null,
        signedTimeStart: null,
        signedTimeEnd: null,
        phone: null,
        recipient: null,
        address: null,
        // exportParam: "personal",
        bindingSoid: null,
        productCode: null,
        brand: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        sampleTalentInfoId: [
          { required: true, message: "达人信息表ID不能为空", trigger: "blur" },
        ],
        sampleTalentCooperateId: [
          {
            required: true,
            message: "笔记/直播合作ID不能为空",
            trigger: "blur",
          },
        ],
      },
    };
  },
  filters: {
    state1(string) {
      if (string == "note") {
        return "笔记";
      }
      if (string == "live") {
        return "直播";
      }
      if (string == "VFU") {
        return "VFU";
      }
      // if (int == 2) { return "审批通过" };
    },
    state2(string) {
      if (string == "to_apply") {
        return "待提交申请";
      }
      if (string == "dingding_approval") {
        return "待钉钉审核";
      }
      if (string == "supervisor_approval") {
        return "待审核";
      }
      if (string == "product_supervisor") {
        return "待产品中心经理审核";
      }
      if (string == "manage_approval") {
        return "待经理审核";
      }
      if (string == "commodity_approval") {
        return "待商品部审核";
      }
      if (string == "shipped_ready") {
        return "待发货";
      }
      if (string == "shipped") {
        return "已发货";
      }
      if (string == "to_signed") {
        return "待签收";
      }
      if (string == "signed") {
        return "已签收";
      }
      if (string == "to_returned") {
        return "待退货";
      }
      if (string == "returning") {
        return "退货中";
      }
      if (string == "returned") {
        return "已退样";
      }
      if (string == "part_returned") {
        return "部分退样";
      }
      if (string == "not_return") {
        return "不归还";
      }
      if (string == "cancel_return") {
        return "未收到";
      }
      if (string == "end") {
        return "结束";
      }
      if (string == "canceled") {
        return "已取消";
      }
      // if (int == 2) { return "审批通过" };
    },
  },
  created() {},

  mounted() {},
  //记得清空  如果在keepalive中 则使用activated  deactivated
  destroyed() {
    window.onresize = null;
  },
  watch: {
    row: {
      handler: function (newnew, oldold) {
        console.log("newnew", newnew);
        if (newnew) {
          this.getList();
        }
      },
      deep: true,
      immediate: true,
    },
  },
  methods: {
    getdeliveryDurationRange(item) {
      this.row.deliveryDurationRange = item.deliveryDurationRange;
      this.getList();
    },
    handleGo(path) {
      this.$router.push({
        path: path,
      });
    },
    // 打开加载层
    openLoading() {
      this.$modal.loading("正在加载，请稍候！");
    },
    /** 查询样衣申请记录列表 */
    getList() {
      // this.loading = true;
      this.openLoading();
      selectSampleTalentApplyVOList(this.row).then((response) => {
        this.$modal.closeLoading();
        this.sampleApplyList = response.data;
        // this.sampleApplyList.address = response.rows.receiverState + response.rows.receiverCity + response.rows.receiverDistrict + response.rows.address
        // console.log(JSON.stringify(this.sampleApplyList.address));
        this.total = response.totalCount;
        // this.loading = false;
      });
    },
    /** 导出按钮操作 */
    handleExport() {
      let obj = this.row;
      delete obj.thisPageSize;
      delete obj.pageNum;
      this.download(
        "product/OdsSampleTalentApplyReport/selectSampleTalentApplyVOExport",
        {
          ...obj,
        },
        `sampleApply_${new Date().getTime()}.xlsx`
      );
    },
    downLoadFile() {
      let obj = {
        templateName: "样衣申请批量导入模板",
      };
      downLoadTemplate(obj).then((response) => {
        window.location.href =
          process.env.VUE_APP_BASE_API + response.rows[0].templateUrl;
      });
    },
    handleIsReturn() {
      this.openbatchReturn = true;
    },
    //修改归还状态
    submitbatchReturn() {
      let list = [];
      this.ids.forEach((item) => {
        list.push({
          id: item,
          finalIsReturn: this.finalIsReturn,
        });
      });
      batchEditIsReturn(list).then((response) => {
        this.openbatchReturn = false;
        this.getList();
      });
    },
    //检测发货状态
    handlecheckPackageStatus() {
      // this.openLoading3();
      checkPackageStatus(this.ids).then((response) => {
        // this.$modal.closeLoading();
        this.$modal.msgSuccess("检查通过");
      });
    },
    //检测钉钉状态
    handlecheckDingdingStatus() {
      this.openLoading3();
      checkDingdingStatus(this.ids).then((response) => {
        this.$modal.closeLoading();
        this.changeState();
      });
    },
    //检查无信息售后单
    handlecheckAfterSaleNoInfoReq() {
      if (!this.formApply.remark) {
        this.$modal.msgError("请填写寄样原因");
        return;
      }
      axios
        .post(
          process.env.VUE_APP_BASE_API +
            "/product/sampleApply/checkAfterSaleNoInfoReq",
          this.ids,
          {
            headers: {
              header: {
                // responseType: "blob"
              },

              Authorization: "Bearer " + getToken(),
              // "Content-Type": "multipart/form-data",
            }, //定义内容格式,很重要
            // timeout: 20000,
          }
        )
        .then((response) => {
          console.log(response);
          if (response.data.code == 200) {
            this.handlecheckInventory();
          } else if (response.data.code == 500) {
            this.$alert(response.data.msg, "提示", {
              confirmButtonText: "前往认领",
            }).then(() => {
              this.$router.push({
                path: "/sample/AfterSalesOrder",
                query: { deptBelong: "My" },
              });
            });
          }
        });
      // checkAfterSaleNoInfoReq(this.ids)
      //   .then((response) => {
      //     // if (response.code == 500) {
      //     //   this.$alert(response.msg, "提示", {
      //     //     confirmButtonText: "确定",
      //     //   });
      //     // } else
      //     if (response.code == 200) {
      //       this.handlecheckInventory();
      //     }
      //   })
      //   .catch((error) => {
      //     this.$alert(error, "提示", {
      //       confirmButtonText: "确定",
      //     });
      //   });
    },
    //检查库存
    handlecheckInventory() {
      this.openLoading2();
      checkInventory(this.ids).then((response) => {
        this.$modal.closeLoading();
        // if (response.code == 200) {
        // }
        // this.msgInventory = response.msg;
        const jsonObject = JSON.parse(response.msg);
        this.msgInventory = jsonObject.data;
        console.log(JSON.stringify(jsonObject));
        if (jsonObject.code == 200) {
          this.submitApply();
        } else {
          this.openInventory = true;
        }
      });
    },
    //修改对话框
    //添加颜色列表获得焦点
    onFocus() {
      // this.getData();

      // this.getSize();
      this.changeAddress("");
      // if (!this.form.colorProperty) {
      //     this.$selectRef.value.blur() //就是这一句，
      // }
    },
    submitSelf() {
      if (!this.fReturn.expressNumber) {
        this.$modal.msgError("请输入退货快递单号");
        return;
      }
      var formreturn = {
        returnMethod: "selfsending",
        sampleTalentInfoId: this.sampleTalentInfoId[0],
        applyIds: this.ids,
        ...this.fReturn,
      };
      console.log(JSON.stringify(formreturn));
      // return
      this.openLoading();
      axios
        .post(
          process.env.VUE_APP_BASE_API +
            "/product/sampleApply/returnApplyByApplyID",
          formreturn,
          {
            headers: {
              header: {
                // responseType: "blob"
              },

              Authorization: "Bearer " + getToken(),
              // "Content-Type": "multipart/form-data",
            }, //定义内容格式,很重要
            // timeout: 20000,
          }
        )
        .then((response) => {
          this.$modal.closeLoading();
          if (response.data.code == 200) {
            // if (response.data.msg == "操作完成！") {
            this.$modal.msgSuccess("申请成功");
            this.$router.push({
              path: "/sample/sampleReturn",
              query: { sampleTalentInfoId: this.sampleTalentInfoId[0] },
            });
            // } else {
            //   this.$modal.msgError(response.data.msg);
            // }
          } else if (response.data.code == 500) {
            // this.$alert(
            //   "快递单号已存在，请在聚水潭售后单查询该快递单号!",
            //   "提示",
            //   {
            //     confirmButtonText: "确定",
            //   }
            // ).then(() => {
            //   this.$router.push({
            //     path: "/sample/AfterSalesOrder",
            //     query: { trackingNumber: this.fReturn.expressNumber },
            //   });
            // });
            this.$alert(response.data.msg, "提示", {
              confirmButtonText: "前往认领",
            }).then(() => {
              this.$router.push({
                path: "/sample/AfterSalesOrder",
                query: { trackingNumber: this.fReturn.expressNumber },
              });
            });
          }
          // else {
          //   this.$modal.msgError(response.msg);
          // }
        });
    },
    changeAddress(val) {
      console.log(val);
      search(val).then((response) => {
        console.log(JSON.stringify(response));
        this.returnAddressList = response;
      });
    },
    changeStatus(val) {
      console.log(val);
      if (val == 0) {
        console.log(0);
        this.fReturn = {};
        // this.fReturn.expressCompany = '中通快递'
        this.noSelf = true;
      } else {
        console.log(1);
        this.fReturn = {};
        // this.fReturn.expressCompany = '中通快递'
        this.noSelf = false;
      }
    },

    //申请退货
    chatReturn(row) {
      if (this.sampleTalentInfoId.length !== 1) {
        this.$modal.msgError("请选择一个达人信息！");
        return;
      }

      listContact({ sampleTalentInfoId: this.sampleTalentInfoId[0] }).then(
        (res) => {
          if (res.rows.length == 0) {
            this.$modal.msgError("请添加达人收件信息！");
            return;
          } else if (res.rows.length > 0) {
            this.optionsContact = res.rows;
            console.log(JSON.stringify(this.optionsContact));
            this.Visiblereturn = true;
          }
        }
      );
    },
    Return() {
      this.Visiblereturn = false;
    },
    submitReturn() {
      // if (!this.fReturn.returnContactId) {
      //   this.$modal.msgError("请选择取件地址");
      //   return;
      // }
      if (!this.fReturn.sampleReturnAddressId) {
        this.$modal.msgError("请选择仓库地址");
        return;
      }
      var pickupStartTime = this.returnDate.split("-")[0];
      var pickupEndTime = this.returnDate.split("-")[1];
      console.log(JSON.stringify(pickupStartTime));
      console.log(JSON.stringify(pickupEndTime));
      var formreturn = {
        returnMethod: "pickup",
        sampleTalentInfoId: this.sampleTalentInfoId[0],
        applyIds: this.ids,
        // returnContactId: this.ids[0],
        ...this.fReturn,
        pickupStartTime: pickupStartTime,
        pickupEndTime: pickupEndTime,
      };
      console.log(JSON.stringify(formreturn));
      // return
      returnApplyByApplyID(formreturn).then((response) => {
        if (response.code == 200) {
          if (response.msg == "操作完成！") {
            this.$modal.msgSuccess("申请成功");
            this.$router.push({
              path: "/sample/sampleReturn",
              query: { sampleTalentInfoId: this.sampleTalentInfoId[0] },
            });
          } else {
            this.$modal.msgError(response.msg);
          }
        } else {
          this.$modal.msgError(response.msg);
        }
      });
    },
    //获取库存
    getinventory() {
      inventory({
        productNo: this.form.productNo,
        colorProperity: this.form.colorProperty,
        size: this.form.size,
      }).then((res) => {
        // console.log(JSON.stringify(res.data));
        if (res.code == 200) {
          if (res.data.length > 0) {
            this.num = res.data[0].publicCanUseNum;
            this.$forceUpdate();
          } else {
            this.$modal.msgError("该商品编码聚水潭不存在，请核对。");
          }
        }
        // else {
        //   this.$modal.msgError(res.msg)
        // }
      });
    },

    //退货情况
    getlistSampleReturn(row) {
      listSampleReturn({ sampleTalentApplyId: row.id }).then((response) => {
        if (response.rows.length <= 0) {
          this.$modal.msgError("暂无数据！");
          this.openReturnList = false;
        } else {
          this.sampleReturnList = response.rows;
          this.openReturnList = true;
        }
      });
    },
    goto(row) {
      this.$router.push({
        path: "/sample/sampleReturn",
        query: { id: row.id },
      });
    },
    // MySampleTalentApply() {
    //   selectMySampleTalentApply({ userId: this.userId, applyStatus: null }).then(res => {
    //     this.sampleApplyList = res.data
    //     // this.state = false
    //   })
    // },
    //分页
    pageList() {
      if (this.queryParams.exportParam == "personal") {
        this.queryParams.createBy = this.userId;
        this.queryParams.applyId = this.userId;
        //个人申请
        this.getList();
      } else if (this.queryParams.exportParam == "depart") {
        //部门记录
        this.getdeptlist();
      } else if (this.queryParams.exportParam == "all") {
        //公司所有
        this.getAllList();
      }
    },
    //我的申请
    changeState(val) {
      this.queryParams.pageNum = 1;
      this.openCheck = false;
      // console.log(val);
      // console.log(this.userId);
      if (this.queryParams.exportParam == "personal") {
        this.queryParams.createBy = this.userId;
        this.queryParams.applyId = this.userId;
        //个人申请
        this.getList();
      } else if (this.queryParams.exportParam == "depart") {
        //部门记录
        this.getdeptlist();
      } else if (this.queryParams.exportParam == "all") {
        //公司所有
        this.getAllList();
      }
    },
    //归还不归还
    changeReturn(val) {
      this.queryParams.pageNum = 1;
      // console.log();
      if (this.queryParams.exportParam == "personal") {
        this.queryParams.createBy = this.userId;
        this.queryParams.applyId = this.userId;
        //个人申请
        this.getList();
      } else if (this.queryParams.exportParam == "depart") {
        //部门记录
        this.getdeptlist();
      } else if (this.queryParams.exportParam == "all") {
        //公司所有
        this.getAllList();
      }
    },
    //发货状态改变
    changeTheme(val) {
      console.log(val);
      this.queryParams.pageNum = 1;
      if (this.queryParams.exportParam == "personal") {
        this.queryParams.createBy = this.userId;
        this.queryParams.applyId = this.userId;
        //个人申请
        this.getList();
      } else if (this.queryParams.exportParam == "depart") {
        //部门记录
        this.getdeptlist();
      } else if (this.queryParams.exportParam == "all") {
        //公司所有
        this.getAllList();
      }
    },
    //公司所有
    getAllList() {
      this.queryParams.createBy = "";
      alllistSampleApply(this.queryParams).then((response) => {
        this.sampleApplyList = response.rows;

        this.total = response.total;
      });
    },
    //部门记录
    getdeptlist() {
      this.queryParams.createBy = "";

      deptlistSampleApply(this.queryParams).then((response) => {
        this.sampleApplyList = response.rows;

        this.total = response.total;
      });
    },
    //流转记录
    statusList(row) {
      selectFlowInstanceRecordListExt({
        businessId: row.id,
        businessType: "sampleApply",
      }).then((response) => {
        this.ApplyList = response.data;
        this.openApply = true;
      });
    },
    handleApplyExcel() {
      var apply = [];
      this.list.forEach((item) => {
        apply.push({
          businessId: item.id,
          applyStatus: item.applyStatus,
          applyId: this.userId,
        });
      });
      // console.log();
      // apply = JSON.stringify(apply);
      startApplyExcel(apply).then((data) => {
        const isBlob = blobValidate(data);
        if (isBlob) {
          const blob = new Blob([data]);
          saveAs(blob, "申请表");
        }
      });
      // this.download(
      //   "product/sampleApply/startApplyExcel",
      //   {
      //     ...apply,
      //   },
      //   // headers: {
      //   // header: { responseType: "blob" },

      //   // Authorization: "Bearer " + getToken(),
      //   // "Content-Type": "application/json",
      //   // },
      //   `申请表_${new Date().getTime()}.xlsx`
      // );
    },
    //申请按钮
    submitApply() {
      // if (!this.formApply.remark) {
      //   this.$modal.msgError("请输入申请理由");
      //   return;
      // }
      var apply = [];
      this.list.forEach((item) => {
        apply.push({
          businessId: item.id,
          applyStatus: item.applyStatus,
          applyId: this.userId,
          ...this.formApply,
        });
      });

      // this.$modal.confirm('是否直接提交？').then(function () {

      //   return startApplyFlow(apply);
      // }).then((res) => {
      //   this.Visibleapply = false
      //   this.getList();
      //   if (res.code == 200) {

      //     if (res.msg == '') {
      //       this.$modal.msgSuccess('申请成功')
      //     } else {
      //       this.$modal.msgError(res.msg)
      //     }
      //   }
      // }).catch(() => { });
      console.log(JSON.stringify(apply.length));
      this.Visibleapply = false;
      this.openLoading();
      startApplyFlow(apply).then((res) => {
        this.$modal.closeLoading();

        this.getList();
        if (res.code == 200) {
          if (res.msg == "") {
            this.$modal.msgSuccess("申请成功");
            this.openInventory = false;
            this.getList();
          } else {
            this.$modal.msgError(res.msg);
          }
        }
      });
    },
    closeInventory() {
      this.openInventory = false;
      this.Visibleapply = false;
    },
    // 打开加载层
    openLoading3() {
      this.$modal.loading("正在检测钉钉状态，请稍候！");
    },
    // 打开加载层
    openLoading2() {
      this.$modal.loading("正在检查库存，请稍候！");
    },
    // 打开加载层
    openLoading() {
      this.$modal.loading("正在提交申请，请稍候！");
    },

    //判断是否打开申请
    ToDoapply() {
      if (this.to_apply.length == 0) {
        this.$modal.msgError("请选择至少一条待申请记录信息！");
        return;
      }
      if (this.color.indexOf(null) >= 0) {
        this.Visibleapply = false;
        this.$modal.msgError("请完善申请记录信息！颜色");
        return;
      }
      if (this.size.indexOf(null) >= 0) {
        this.Visibleapply = false;
        this.$modal.msgError("请完善申请记录信息！尺寸");
        return;
      }
      if (this.productNum.indexOf(null) >= 0) {
        this.Visibleapply = false;
        this.$modal.msgError("请完善申请记录信息！数量");
        return;
      }
      if (this.isReturn.indexOf(null) >= 0) {
        this.Visibleapply = false;
        this.$modal.msgError("请完善申请记录信息！归还");
        return;
      }

      if (this.to_apply.length == 1 && this.to_apply[0] == "to_apply") {
        if (this.username.length == 1 && this.username[0] == this.applyname) {
          this.Visibleapply = true;
        } else {
          this.Visibleapply = false;
          this.$modal.msgError("请选择本人申请记录信息！");
          return;
        }
      } else {
        this.Visibleapply = false;
        this.$modal.msgError("订单处于 “非待提交申请”状态，暂不可申请。");
        return;
      }

      // if(this.filter)
      // for (let index = 0; index < this.to_apply.length; index++) {
      //   // const element = array[index];

      // }
    },
    cancelApply() {
      this.Visibleapply = false;
    },
    //admin申请按钮
    ToDobutton() {
      this.openLoading();
      uploadIst(this.ids).then((res) => {
        this.$modal.closeLoading();

        this.getList();
        if (res.code == 200) {
          // if (res.msg == "") {
          this.$modal.msgSuccess("申请成功");
          // }
        } else {
          this.$modal.msgError(res.msg);
        }
      });
    },
    getroles() {
      // var userId = null
      getInfo().then((res) => {
        console.log(JSON.stringify(res));
        this.applyname = res.user.dept.deptName + "-" + res.user.userName;
        console.log(JSON.stringify(this.applyname));
        this.userId = res.user.userId;
        this.queryParams.createBy = this.userId;
        console.log(JSON.stringify(this.userId));
        //当前操作用户角色
        this.roles = res.roles;
        console.log(JSON.stringify(this.roles));
        this.getList();
      });
    },
    isCheck() {
      selectSampleTalentApplyToDo().then((res) => {
        if (res.data.length > 0) {
          this.TypeCheck = true;
          this.listSample = res.data.length;
        } else {
          this.TypeCheck = false;
        }
      });
    },
    //我的待办
    ToDo() {
      selectSampleTalentApplyToDo().then((res) => {
        this.sampleApplyList = res.data;
        if (res.data.length > 0) {
          this.openCheck = true;
        } else {
          this.openCheck = false;
        }
        this.total = this.sampleApplyList.length;
      });
    },
    //是否审批
    ToDoCheck() {
      if (this.list.length == 0) {
        this.$modal.msgError("请选择一条记录信息！");
        return;
      }
      // console.log(JSON.stringify());

      // this.to_apply.forEach(item => {
      //   if (item.('to_apply')) {
      //     this.VisibleCheck = false
      //     // return
      //   } else {
      //     this.VisibleCheck = true
      //   }

      // })
      if (this.to_apply.indexOf("to_apply") >= 0) {
        this.VisibleCheck = false;
        this.$modal.msgError("请选择待审批记录信息！");
        return;
      } else {
        this.VisibleCheck = true;
      }
    },
    cancelCheck() {
      this.VisibleCheck = false;
    },
    submitCheck() {
      var check = [];
      this.list.forEach((item) => {
        check.push({
          businessId: item.id,
          applyStatus: item.applyStatus,
          ...this.formCheck,
        });
      });
      console.log(JSON.stringify(check));
      // return
      SampleTalentApplyCheck(check).then((response) => {
        if (response.code == 200) {
          this.$modal.msgSuccess("申批成功");
          this.VisibleCheck = false;
          this.ToDo();
        }
      });
    },
    // //发起退货
    // chatReturn() {
    //   if (this.list.length > 1 || this.list.length == 0) {
    //     this.$modal.msgError("请选择一条记录信息！");
    //     return;
    //   }
    //   // if (this.to_apply.length == 1 && this.to_apply[0] == 'to_apply') {
    //   //   this.Visibleapply = true
    //   // } else {
    //   //   this.Visibleapply = false
    //   //   this.$modal.msgError('包含非待申请记录信息！')
    //   //   return
    //   // }
    //   returnApply(this.list[0]).then((response) => {
    //     if (response.code == 200) {
    //       this.$modal.msgSuccess("申请成功");
    //       this.getList();
    //     }
    //   });
    // },

    // chatReturn() {
    //   if (this.list.length > 1 || this.list.length == 0) {
    //     this.$modal.msgError("请选择一条记录信息！");
    //     return;
    //   }
    //   returnApply(this.list[0]).then((response) => {
    //     if (response.code == 200) {
    //       this.$modal.msgSuccess("申请成功");
    //       this.getList();
    //     }
    //   });
    // },

    //修改对话框
    //添加颜色列表获得焦点
    onFocus() {
      this.getData();

      this.getSize();
      // if (!this.form.colorProperty) {
      //     this.$selectRef.value.blur() //就是这一句，
      // }
    },
    testSize() {
      this.getinventory();
    },

    //修改对话框
    /* 获取颜色列表 */
    getSize(key) {
      console.log(JSON.stringify(key));
      // this.loading = true;
      // return
      listAll({
        productNo: this.form.productNo,
        colorProperty: this.form.colorProperty,
      }).then((res) => {
        // this.loading = false;
        this.sizeList = res;
        console.log(JSON.stringify(res));
      });
    },
    /* 获取颜色列表 */
    getData(key) {
      console.log(JSON.stringify(key));
      // this.loading = true;
      // return
      productNoColorLike({ productNo: this.form.productNo, color: key }).then(
        (res) => {
          // this.loading = false;
          this.ColorLike = res.data;
          console.log(JSON.stringify(this.ColorLike));
        }
      );
    },

    /* 获取货号列表 */
    getDatas(key) {
      console.log(JSON.stringify(key));
      this.loading = true;
      // return
      productNoLike(key).then((res) => {
        this.loading = false;
        this.options = res.data;
        console.log(JSON.stringify(this.options));
      });
    },
    //搜索栏展示与收起
    shouqi() {
      this.openCheck = false;
      // console.log(1);
      this.isOpen = !this.isOpen;
    },
    //点击某一行
    t(row, column, cell, event) {
      console.log(row, column, cell, event);
      this.handleUpdate(row);
    },
    // formatData(row) {
    //   let rowPerson = (row) || [];
    //   let arr = [];
    //   rowPerson.forEach(item => {
    //     //如果数据特别多的话,还可以在这里加if判断,仅展示规定的数据
    //     arr.push(item.receiverState, item.receiverCity, item.receiverDistrict, item.address);
    //   });
    //   //
    //   return arr.join("/");
    // },

    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        sampleTalentInfoId: null,
        sampleTalentCooperateId: null,
        sampleTalentCooperateType: null,
        templateId: null,
        templateSecondryId: null,
        templateSizeId: null,
        contactId: null,
        isReturn: null,
        remark: null,
        onlineNumber: null,
        subOrderNumber: null,
        buyerAccount: null,
        paymentOrderNumber: null,
        paymentMethod: null,
        freight: null,
        payableAmount: null,
        fixedLine: null,
        zipCode: null,
        styleMainImage: null,
        productCode: null,
        productNum: null,
        productName: null,
        productPricing: null,
        productCost: null,
        productSettlment: null,
        productBatch: null,
        manufactureDate: null,
        expressCompany: null,
        expressNumber: null,
        deliveryTime: null,
        salesman: null,
        offlineNotes: null,
        applyStatus: null,
        isDelete: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        returnPhone: null,
        returnRecipient: null,
        returnAddress: null,
        returnContactId: null,
        returnExpressPickupCode: null,
        returnExpressNumber: null,
        returnDate: null,
        isReturnRemark: null,
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      if (this.queryParams.exportParam == "personal") {
        this.queryParams.createBy = this.userId;
        this.queryParams.applyId = this.userId;
        //个人申请
        this.getList();
      } else if (this.queryParams.exportParam == "depart") {
        //部门记录
        this.getdeptlist();
      } else if (this.queryParams.exportParam == "all") {
        //公司所有
        this.getAllList();
      }
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.openCheck = false;
      this.resetForm("queryForm");
      this.queryParams = {};
      this.queryParams.exportParam = "personal";
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.id);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
      this.list = selection.map((item) => item);
      console.log(JSON.stringify(this.list));
      var username = selection.map((item) => item.buyerAccount);
      console.log(JSON.stringify(username));
      this.username = Array.from(new Set(username));

      console.log(JSON.stringify(this.username));

      var to_apply = selection.map((item) => item.applyStatus);
      console.log(JSON.stringify(to_apply));
      this.color = selection.map((item) => item.colorProperty);

      this.size = selection.map((item) => item.size);
      console.log(JSON.stringify(this.size));

      this.productNum = selection.map((item) => item.productNum);
      console.log(JSON.stringify(this.productNum));

      this.isReturn = selection.map((item) => item.isReturn);

      var sampleTalentInfoId = selection.map((item) => item.sampleTalentInfoId);
      this.sampleTalentInfoId = Array.from(new Set(sampleTalentInfoId));
      // var apply = []
      // to_apply.forEach(item => {
      //   if (item.includes('to_apply')) {

      //     apply.push(item)
      //   }

      // })
      this.to_apply = Array.from(new Set(to_apply));

      console.log(JSON.stringify(this.to_apply));
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加样衣申请记录";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids;
      getSampleApply(id).then((response) => {
        this.form = response.data;
        //不可编辑状态判断是否处于“待提交申请”
        if (response.data.applyStatus !== "to_apply") {
          //
          this.to_sumbit = true;
        } else {
          // console.log(5555454);
          this.to_sumbit = false;
        }

        console.log(JSON.stringify(response.data));
        if (row.buyerAccount == this.applyname) {
          if (response.data.applyStatus == "dingding_approval") {
            this.open = false;
            this.$modal.msgError("订单处于 “待钉钉审核”状态，暂不可修改。");
            return;
          } else {
            this.open = true;
          }
        } else {
          this.open = false;
          this.$modal.msgError("请选择本人申请记录信息！");
          return;
        }
        if (row.colorProperty) {
          this.getinventory();
        }

        this.title = "修改样衣申请记录";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          if (this.form.id != null) {
            updateSampleApply(this.form).then((response) => {
              if (response.msg == "") {
                this.$modal.msgSuccess("操作成功");
              } else {
                this.$modal.msgError(response.msg);
              }
              this.open = false;
              this.changeEdit();
            });
          } else {
            addSampleApply(this.form).then((response) => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.changeEdit();
            });
          }
        }
      });
    },
    changeEdit(val) {
      // console.log(val);
      // console.log(this.userId);
      if (this.queryParams.exportParam == "personal") {
        this.queryParams.createBy = this.userId;
        this.queryParams.applyId = this.userId;
        //个人申请
        this.getList();
      } else if (this.queryParams.exportParam == "depart") {
        //部门记录
        this.getdeptlist();
      } else if (this.queryParams.exportParam == "all") {
        //公司所有
        this.getAllList();
      }
    },

    addText() {
      if (!this.demo) {
        this.$modal.msgError("请输入内容");
        return;
      }
      let address = this.demo.replace(/\s+/g, " ");
      const result = AddressParse.parse(address);

      this.form.phone = result[0].mobile ? result[0].mobile : "";
      this.form.recipient = result[0].name ? result[0].name : "";
      this.form.receiverState = result[0].province ? result[0].province : "";
      this.form.receiverCity = result[0].city ? result[0].city : "";
      this.form.receiverDistrict = result[0].area ? result[0].area : "";
      this.form.address = result[0].details;
      this.seletekey(this.form.receiverState, "province");
      this.seletekey(this.form.receiverCity, "city");
      this.seletekey(this.form.receiverDistrict, "area");
      // axios({
      //   method: "post",
      //   url: "https://wangzc.wang/smAddress",
      //   // url: "http://47.97.123.182:1399/smAddress",
      //   data: {
      //     address: address,
      //   },
      // }).then((res) => {
      //   // console.log(JSON.stringify(res.data));
      //   this.form.phone = res.data.phone ? res.data.phone : "";
      //   this.form.recipient = res.data.name ? res.data.name : "";
      //   this.form.receiverState = res.data.province ? res.data.province : "";
      //   this.form.receiverCity = res.data.city ? res.data.city : "";
      //   this.form.receiverDistrict = res.data.county ? res.data.county : "";
      //   this.form.address = res.data.street
      //     ? res.data.street + res.data.address
      //     : res.data.address;
      //   this.seletekey(this.form.receiverState, "province");
      //   this.seletekey(this.form.receiverCity, "city");
      //   this.seletekey(this.form.receiverDistrict, "area");
      // });
    },
    seletekey(e, type) {
      if (e) {
        switch (type) {
          case "province":
            Object.keys(this.provinces).filter((item) => {
              if (this.provinces[item] === e) {
                this.citys = this.pcaaData[item];
              }
            });
            break;
          case "city":
            Object.keys(this.citys).filter((item) => {
              if (this.citys[item] === e) {
                this.areas = this.pcaaData[item];
              }
            });
            break;
          case "area":
            this.form.receiverDistrict = e;
            this.$forceUpdate();
            break;
        }
      }
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      // if (row.buyerAccount !== this.applyname) {
      //   this.$modal.msgError('请选择本人申请记录信息！')
      //   return
      // }
      const ids = row.id || this.ids;

      this.$modal
        .confirm('是否确认删除样衣申请记录编号为"' + ids + '"的数据项？')
        .then(function () {
          return delSampleApply(ids);
        })
        .then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
        })
        .catch(() => {});
    },

    //图片上传前的相关判断
    beforeAvatarUpload(file) {
      // const isJPG = file.type == 'image/jpeg' || file.type == 'image/png';
      const isLt2M = file.size / 1024 / 1024 < 100;
      // if (!isJPG) {
      //     this.$message.error('上传头像图片只能是 JPG/PNG 格式!');
      // }
      if (!isLt2M) {
        this.$message.error("上传导入文件大小不能超过 100MB!");
      }
      this.openUploadLoading();
      return isLt2M;
    },
    //图片预览
    handlePictureCardPreview(file) {
      this.picUrl = file.url;
      this.imageUrl = file.url;
      // this.dialogVisible = true;
    },
    //部门文件导入修改打开
    daoru() {
      this.dialogVisible = true;
    },
    // 打开加载层
    openUploadLoading() {
      this.$modal.loading("正在导入，请稍候！");
    },
    //文件导入成功回传

    handlePictureSuccessPic(response, file) {
      console.log(JSON.stringify(file));
      console.log(JSON.stringify(response));
      this.dialogVisible = false;
      this.$modal.closeLoading();
      this.openmsg = true;
      this.msg = response.msg;

      //设置图片访问路径 （url 后台传过来的的上传地址）
      // this.picUrl = file.response.url;
      // const url = file.response.fileName;
      // this.file = file.response.url;
      // console.log(JSON.stringify(this.file));
      // if (res.code == 200) {

      //   this.dialogVisible = false

      //   if (res.msg == '操作成功') {

      //     this.$modal.msgSuccess('导入成功')
      //   } else {
      //     this.$modal.msgError(res.msg);
      //   }
      //   this.getList();
      //   // return true
      // } else {
      //   this.$modal.msgError(res.msg);
      //   this.dialogVisible = true
      //   // this.$message.msgError('该颜色未在字典定义')
      //   return
      // }
    },

    // 文件个数超出
    handleExceed() {
      this.$modal.msgError(`上传链接文件数量不能超过 ${this.limit} 个!`);
    },
    // 上传文件让第二次覆盖第一的文件
    changeFile1(file, fileList) {
      if (fileList.length > 1) {
        this.fileLi = fileList.slice(-1);

        // this.fileList = [fileList[fileList.length - 1]]//这一步，是 展示最后一次选择文件
      }
      // this.fileSpecial = fileList;
    },
    // table自动高度
    returnTableHeight(ref, bottomOffset) {
      let height = null;
      height =
        window.innerHeight - ref.getBoundingClientRect().top - bottomOffset;
      return height;
    },

    resizeTable() {
      this.$nextTick(() => {
        this.tableHeight = this.returnTableHeight(this.$refs.tableDom, 100);
      }, 0);
    },
  },
};
</script>
<style lang="scss" scoped>
::v-deep input::-webkit-outer-spin-button,
::v-deep input::-webkit-inner-spin-button {
  -webkit-appearance: none !important;
}

// ::v-deep input[type='number'] {
//   // -moz-appearance: textfield !important;
// }

.el-dialog-div {
  height: 50vh;
  overflow-x: hidden;
}

span.textname {
  display: -webkit-box;

  text-overflow: ellipsis;
  overflow: hidden;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  white-space: pre-wrap;
}

.el-input.is-disabled ::v-deep .el-input__inner {
  color: #606266;
  background-color: white;
  border: none;
}

.el-textarea.is-disabled ::v-deep .el-textarea__inner {
  color: #606266;
  background-color: white;
  border: none;
  width: 500px;
  resize: none;
  cursor: pointer;
}
</style>
public class AddressParsing extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 唯一标识符 */
    private Long id;

    /** 完整的地址信息 */
    @Excel(name = "完整的地址信息")
    private String fullAddress;

    /** 省份名称 */
    @Excel(name = "省份名称")
    private String province;

    /** 城市名称 */
    @Excel(name = "城市名称")
    private String city;

    /** 区县名称 */
    @Excel(name = "区县名称")
    private String district;

    /** 详细的地址描述，如街道、门牌号等 */
    @Excel(name = "详细的地址描述，如街道、门牌号等")
    private String detailedAddress;

    /** 收件人的电话号码 */
    @Excel(name = "收件人的电话号码")
    private String recipientPhone;

    /** 收件人的名字 */
    @Excel(name = "收件人的名字")
    private String recipientName;


}